<div class="pd-20">
    <form method="post" class="form form-horizontal" action="{:U('Admin/Buyer/bandUser')}" onsubmit="return bandTip()">
    	<input type="hidden" name="id" value="{$user['id']}">
        <div class="row cl">
        	<label class="form-label col-3"><span class="c-red"></span>昵称</label>
            <div class="col-6">
	            <input type="text" class="input-text" value="{$user['nickname']}" placeholder="" id="sort_name" name="sort_name" datatype="*2-16" nullmsg="" disabled="disabled">
            </div>
            <div class="col-3"><img src="{$user['headimgurl']}" width="50px" height="50px" style="padding-left: 20px;"></div>
        </div>
        <!--div class="row cl">
        	<label class="form-label col-3"><span class="c-red"></span>套餐</label>
            <div class="col-6">
	            <input type="text" class="input-text" <if condition="$user.colid eq NULL">value=""<else/>value="{$user.colid}"</if> placeholder="" id="sort_name" name="colid" datatype="*2-16" nullmsg="">
            </div>
            <div class="col-3"></div>
        </div-->
        <div class="row cl">
        	<label class="form-label col-3"><span class="c-red"></span>菜篮子号</label>
            <div class="col-6">
	            <input type="text" class="input-text" <if condition="$user.basketid eq 0">value=""<else/>value="{$user.basketid}"</if> placeholder="" id="basketid" name="basketid" datatype="*2-16" nullmsg="">
            </div>
            <div class="col-3"><a class="btn btn-success" onclick="getUserInfo()" style="margin-left: 20px; font-size: 12px;padding: 0px 0px; height: 24px;">获取用户</a></div>
        </div>
        <div class="row cl">
        	<label class="form-label col-3"><span class="c-red"></span>真实姓名</label>
            <div class="col-6">
	            <input type="text" class="input-text" <if condition="$user.truename eq NULL">value=""<else/>value="{$user.truename}"</if> placeholder="" id="truename" name="truename" datatype="*2-16" nullmsg="">
            </div>
            <div class="col-3"></div>
        </div>
        <div class="row cl">
        	<label class="form-label col-3"><span class="c-red"></span>地址</label>
            <div class="col-6">
	            <input type="text" class="input-text" <if condition="$user.address eq NULL">value=""<else/>value="{$user.address}"</if> placeholder="" id="address" name="address" datatype="*2-16" nullmsg="">
            </div>
            <div class="col-3"></div>
        </div>
        <div class="row cl">
        	<label class="form-label col-3"><span class="c-red"></span>电话</label>
            <div class="col-6">
	            <input type="text" class="input-text" <if condition="$user.tell eq NULL">value=""<else/>value="{$user.tell}"</if> placeholder="" id="tell" name="tell" datatype="*2-16" nullmsg="">
            </div>
            <div class="col-3"></div>
        </div>
        <div class="row cl">
            <div class="col-9 col-offset-3">
                <input name="fomr-add" class="btn btn-success " type="submit" value="&nbsp;提交&nbsp;">
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
<script type="text/javascript">
function getUserInfo() {
	var bid = $('#basketid').val();
	$.ajax({
		url: "{:U('Admin/Buyer/getOneUserInfo')}",
		data: {
			basketid: bid,
		},
		type: 'post',
		dataType: 'json',
		success: function(data) {
			if(data.code == 1) {
				$('#truename').val(data.truename);
				$('#tell').val(data.tell);
				$('#address').val(data.address);
			} else if(data.code == 0) {
				layer.msg(data.result, {icon: 1});
			}
		},
		error: function() {
			layer.msg('更新出错，请检查！', {icon: 1});
		}
	});
}

function bandTip() {
	var basketid = $('#basketid').val();
	var id   = $('#id').val();
	layer.confirm('确定绑定？', {
		btn: ['确定', '取消']
	}, function() {
		return true;
	}, function() {
		return false;
	});
}
</script>